<template>
  <div>
    <h3>
      精选专题
      <i class="iconfont icon-bottom"></i>
    </h3>
    <div class="view">
      <div class="scroll">
        <div v-for="item in lists" :key="item.id">
          <img :src="item.pic" alt="" />
          <p>{{ item.title }}</p>
          <p>{{ item.descript }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import { getJingxuan } from "../utils/api/index"
  export default {
    data() {
      return {
        lists: [],
      }
    },
    created() {
      getJingxuan().then((res) => {
        this.lists = res.data
      })
    },
  }
</script>

<style lang="scss" scoped>
  h3 {
    text-align: center;
    font-size: 0.32rem;
    height: 0.8rem;
    line-height: 0.8rem;
  }
  .view {
    border-bottom: 0.2rem solid #f5f5f5;
    padding-bottom: 0.2rem;
  }
  .scroll {
    display: flex;
    overflow-x: auto;
    &::-webkit-scrollbar {
      display: none;
    }
    div {
      width: 6.38rem;
      flex-shrink: 0;
      margin-left: 0.14rem;
      p {
        margin-top: 0.2rem;
        width: 80%;
        font-size: 0.28rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        &:last-child {
          color: gray;
        }
      }
      img {
        width: 100%;
        height: 4.1rem;
        display: block;
        border-radius: 0.1rem;
      }
    }
  }
</style>
